cmake_minimum_required(VERSION 3.8)
project(fishbot_generic_behaviors)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-result)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(behaviortree_cpp REQUIRED)
find_package(fishbot_behavior_tree REQUIRED)
find_package(pluginlib REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(tf2_ros REQUIRED)

pluginlib_export_plugin_description_file(fishbot_behavior_tree plugin.xml)

set(
  THIS_PACKAGE_INCLUDE_DEPENDS
  behaviortree_cpp
  fishbot_behavior_tree
  pluginlib
  geometry_msgs
  rclcpp
  tf2_ros
)

add_library(fishbot_generic_behaviors SHARED
  src/get_geometry_msgs.cpp 
  src/register_behavior.cpp 
)
target_include_directories(fishbot_generic_behaviors PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>
)
ament_target_dependencies(
  fishbot_generic_behaviors
  ${THIS_PACKAGE_INCLUDE_DEPENDS}
)


target_compile_definitions(fishbot_generic_behaviors PRIVATE "FISHBOT_GENERIC_HEAVIORS_BUILDING_LIBRARY")



install(
  DIRECTORY include/
  DESTINATION include
)
install(
  TARGETS fishbot_generic_behaviors
  EXPORT export_${PROJECT_NAME}
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin
)

# if(BUILD_TESTING)
#   find_package(ament_lint_auto REQUIRED)
#   add_subdirectory(test)
#   ament_lint_auto_find_test_dependencies()
# endif()

ament_export_include_directories(
  include
)

ament_export_libraries(
  fishbot_generic_behaviors
)
ament_export_targets(
  export_${PROJECT_NAME}
)

ament_package()
